home *** CD-ROM | disk | FTP | other *** search
- PAGE ,132 ; CONDENSED PRINT
- TITLE PWD - Print Working Directory
- ;
- ; This program prints the pathname to the current
- ; working directory under DOS 2.0
- ; From PC Tech Journal, Feb 84
- ;
- ; Designed to be run as a .COM program
- ;
- DOS MACRO FUNCTION ;Perform DOS function call
- MOV AH,FUNCTION
- INT 021h
- ENDM
- ;
- PUTC MACRO CHAR ;Output a char to the console
- MOV DL,CHAR
- DOS 2
- ENDM
- ;
- CODE SEGMENT
- ASSUME CS:CODE,DS:CODE,ES:CODE
- ;
- ORG 0100h ;Required for COM programs
- START:
- ; ;First get and print current drive
- DOS 019h ;Get default drive from DOS
- ADD AL,'A' ;Make printable
- PUTC AL
- PUTC ':'
- PUTC '\'
- ;
- ; ;Get and print current pathname
- ;
- MOV DL,0
- LEA SI,PATHNAME
- DOS 047h ;Request pathname from DOS
- ;
- PRINTLOOP:
- CMP BYTE PTR[SI],0 ;Pathname terminated by 0
- JZ EXIT
- PUTC [SI]
- INC SI
- JMP PRINTLOOP
- ;
- EXIT:
- INT 020h ;Back to DOS
- ;
- PATHNAME DB 65 DUP (?) ;DOS will put pathname here
- ;
-
- ; NORMAL PRINT
- CODE ENDS
- END START
-